This relates generally to graphics processing and specifically to texture address modes.
Texture is data mapped to a surface of a shape. Typically the texture data is made up of color values. Each pixel in a texture is called a texel. A texel in a color map then is a color value.
Texture filtering is the way that values are read and combined from a source and then made available to a shader in a graphics pipeline. For example, anisotropic filtering involves trilinearly sampling in a trapezoidal area. However, there are many other texture filtering techniques.
Texture coordinates are specified in a range of 0.0 to 1.0 for each dimension. A texture address mode specifies how to handle filter taps or coordinates outside this range. Like the texture filtering technology, there are many texture address modes.
Existing texture address modes are not suitable for sampling only the part of the texture filter kernel that falls inside the texture as they each introduce some kind of bias under the edge. In particular as shown in FIG. 1, when the area that a filter covers (filter footprint) falls over multiple textures, D3D11_TEXTURE_ADDRESS_CLAMP provides for taps to be contained within a texture. A smudged edge biased to one side can result. This method can result in poor image quality.
Another method involves use of a guard band to the texture. This method is illustrated in FIG. 2. The method allocates a larger texture surface (called a guard band) to accommodate the filter width near the texture edges, and duplicate, the adjacent texture's data into the border regions. In effect, the texture filter kernel considers adjacent textures in addition to the texture actually being sampled. This is usually acceptable and may result in improved quality in low-quality rendering scenarios. However, this method requires significantly more memory and bandwidth due to the duplication of data. Also, the shader program must be used to compute some quantities usually computed by the hardware texture sampler. If two fragments are different colors, then resulting samples cause color blend of two fragments. An acceptable color result may occur but at the cost of memory accesses and storage for guard bands and performance of additional computation.
A number of texture taps with individual coordinates (called ti) are weighted using weights (called wi) and summed together for each texture tap. Value i is an integer from 1 to N. The color at each tap's coordinates is determined by the texture address mode function (called F), which is either the texture color at the given coordinate, or the texture color at a modified coordinate as determined by the texture address mode, or a constant border color. The final color (called C) is computed as:C=Σi(wi·F(ti)).The actual computations performed may differ from the mathematical formulation above.
Using this approach, all taps contribute regardless of whether taps fall within a texture. All taps have weight and the sum of weights=1. However, as in the case of the D3D11_TEXTURE_ADDRESS_CLAMP, the taps outside the texture are given weight, and the final color can be distorted.